import { createRouter, createWebHashHistory } from 'vue-router';
import MainLayout from '@/views/MainLayout';

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: { name: 'mainLayout' },
    },
    {
      path: '/home',
      name: 'mainLayout',
      component: MainLayout,
    },
    // 路由匹配不到时回主页
    {
      path: '/:pathMatch(.*)*',
      redirect: '/',
    },
  ],
});

export default router;
